package util;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.regex.Pattern;

public class ValidateUtils {

	/**
	 * 
	 * Retrieve enclausure where validated. Ex.: The first character, you can
	 * start with any character, number or special character.
	 * 
	 * @param whereOnNodes
	 * @return
	 */
	public static List<String> getWhereNodes(StringBuilder whereOnNodes) {

		Scanner scanner = new Scanner(new String(whereOnNodes));

		List<String> stringLines = new ArrayList<>();

		while (scanner.hasNextLine()) {

			String stringLine = scanner.nextLine();

			if (!Pattern.matches("[^?a-zA-Z\\d]*", stringLine)
					&& (!stringLine.startsWith("?"))) {

				stringLines.add(stringLine.trim() + "\n");

			}

		}

		scanner.close();

		return stringLines;

	}

}
